home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr54 / bison118.zip / CONFIGUR < prev    next >
Text File  |  1993-06-01  |  9KB  |  311 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
  21. #        [--prefix=PREFIX] [--exec_prefix=PREFIX] [--with-PROGRAM] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, and --exec_prefix.
  23.  
  24. trap 'rm -f conftest* core; exit 1' 1 3 15
  25.  
  26. for arg in $*; do
  27.   # Handle --exec_prefix with a space before the argument.
  28.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  29.   # Handle --host with a space before the argument.
  30.   elif test x$next_host = xyes; then next_host=
  31.   # Handle --prefix with a space before the argument.
  32.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  33.   # Handle --srcdir with a space before the argument.
  34.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  35.   else
  36.     case $arg in
  37.      -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
  38.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  39.      -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
  40.     next_exec_prefix=yes ;;
  41.  
  42.      -gas | --gas | --ga | --g) ;;
  43.  
  44.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  45.      -host | --host | --hos | --ho | --h)
  46.     next_host=yes ;;
  47.  
  48.      -nfp | --nfp | --nf | --n) ;;
  49.  
  50.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  51.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  52.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  53.     next_prefix=yes ;;
  54.  
  55.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  56.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  58.     next_srcdir=yes ;;
  59.  
  60.      -with-* | --with-*) ;;
  61.  
  62.      *) ;;
  63.     esac
  64.   fi
  65. done
  66.  
  67. test -z "$exec_prefix" && exec_prefix='$(prefix)'
  68.  
  69. INCLUDEDIR=${INCLUDEDIR-/usr/include}
  70.  
  71. rm -f conftest*
  72. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  73.  
  74. # A filename unique to this package, relative to the directory that
  75. # configure is in, which we can look for to find out if srcdir is correct.
  76. unique_file=reduce.c
  77.  
  78. # Makefile rules whose targets are searched for in VPATH need to use $<.
  79. # However, old makes do not support it, so we use a combination
  80. # construction in Makefile.in: `$file<'.
  81. # If srcdir is `.', we use sed to change that to `file' for old makes.
  82. # Otherwise, we use sed to change it to `$<'.
  83. # vpsub is the sed program, which changes `$file<' to one or the other.
  84. vpsub='s,\$\([-./a-zA-Z0-9_][-./a-zA-Z0-9_]*\)<,\1,g'
  85. # srsub changes `@srcdir@' in Makefile.in into either `.' or the path
  86. # of the top of the source tree for the package.
  87. srsub='s,@srcdir@,.,'
  88.  
  89. # Find the source files, if location was not specified.
  90. if test -z "$srcdir"; then
  91.   srcdirdefaulted=yes; srcdir=.
  92.   if test ! -r $unique_file; then srcdir=..; fi
  93. fi
  94. if test ! -r $srcdir/$unique_file; then
  95.   if test x$srcdirdefaulted = xyes; then
  96.     echo "configure: Can not find sources in \`.' or \`..'." 1>&2
  97.   else
  98.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  99.   fi
  100.   exit 1
  101. fi
  102. if test $srcdir != .; then
  103.   VPATH='VPATH = $(srcdir)'
  104.   case $srcdir in
  105.     /*|~*) ;;
  106.     *) srcdir=`pwd`/$srcdir ;; # Make relative path absolute.
  107.   esac
  108.   vpsub='s,\$\([-./a-zA-Z0-9_][-./a-zA-Z0-9_]*\)<,\$<,g'
  109.   srsub="s,@srcdir@,$srcdir,"
  110. fi
  111.  
  112.  
  113. # The Bourne shell writes "command not found" to /dev/tty, so if we get
  114. # a usage message on stderr, we have the program.
  115. #
  116. # ksh and zsh write "command not found" to stderr, but test -n does not
  117. # want any output if there is no program.  So we use the `type' builtin
  118. # instead for them (and bash).
  119. if test "$RANDOM" = "$RANDOM"; then
  120.   checkfor='test -n "`$checkprog $checkargs 2>&1`"'
  121. else
  122.   checkfor='type $checkprog >/dev/null 2>&1'
  123. fi
  124.  
  125. echo checking for gcc
  126. checkprog=gcc checkargs=''
  127. test -z "$CC" && eval $checkfor && CC='gcc '
  128. CC=${CC-cc}
  129.  
  130. # Find out if we are using GNU C, under whatever name.
  131. cat <<EOF > conftest.c
  132. main() {
  133. #ifdef __GNUC__
  134.   exit(0);
  135. #else
  136.   exit(1);
  137. #endif
  138. }
  139. EOF
  140. eval $compile
  141. if test -s conftest && (./conftest) 2>/dev/null; then
  142.   GCC=1 # For later tests.
  143.   CC="$CC -O"
  144. else
  145.   :
  146. fi
  147. rm -f conftest*
  148.  
  149. echo checking for install
  150. # Make sure to not get the incompatible SysV /etc/install and
  151. # /usr/sbin/install, which might be in PATH before a BSD-like install.
  152. if test -z "$INSTALL"; then
  153.   saveifs="$IFS"; IFS="$IFS:"
  154.   for dir in $PATH; do
  155.     test -z "$dir" && dir=.
  156.     case $dir in
  157.     /etc|/usr/sbin) ;;
  158.     *)
  159.       if test -f $dir/install; then
  160.     INSTALL="$dir/install -c"
  161.     INSTALL_PROGRAM='$(INSTALL)'
  162.     INSTALL_DATA='$(INSTALL) -m 644'
  163.     break
  164.       fi
  165.       ;;
  166.     esac
  167.   done
  168.   IFS="$saveifs"
  169. fi
  170. INSTALL=${INSTALL-cp}
  171. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  172. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  173.  
  174. echo checking for POSIXized ISC
  175. if test -d /etc/conf/kconfig.d &&
  176.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  177. then
  178.   ISC=1 # If later tests want to check for ISC.
  179.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  180.   if test -n "$GCC"; then
  181.     CC="$CC -posix"
  182.   else
  183.     CC="$CC -Xp"
  184.   fi
  185. fi
  186.  
  187. echo checking for ANSI C header files
  188. test -r $INCLUDEDIR/stdlib.h && test -r $INCLUDEDIR/string.h &&
  189.   test -r $INCLUDEDIR/limits.h && DEFS="$DEFS -DSTDC_HEADERS=1"
  190.  
  191. echo checking for BSD string and memory functions
  192. echo "#include <strings.h>
  193. main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
  194. eval $compile
  195. if test -s conftest && (./conftest) 2>/dev/null; then :
  196. else
  197.   DEFS="$DEFS -DUSG=1"
  198. fi
  199. rm -f conftest*
  200.  
  201. for func in strerror
  202. do
  203. trfrom='[a-z]' trto='[A-Z]'
  204. echo checking for $func
  205. echo "
  206. main() { exit(0); } t() { 
  207. /* Override any gcc2 internal prototype to avoid an error.  */
  208. extern char ${func}(); ${func}(); }" > conftest.c
  209. eval $compile
  210. if test -s conftest && (./conftest) 2>/dev/null; then :
  211. else
  212.   DEFS="$DEFS -D`echo $func|tr "$trfrom" "$trto"`_MISSING=1"
  213. fi
  214. rm -f conftest*
  215.  
  216. done
  217.  
  218. decl="#ifdef __GNUC__
  219. #define alloca __builtin_alloca
  220. #else
  221. #ifdef sparc
  222. #include <alloca.h>
  223. #else
  224. #ifdef _AIX
  225.  #pragma alloca
  226. #else
  227. char *alloca ();
  228. #endif
  229. #endif
  230. #endif
  231. "
  232. echo checking for alloca
  233. echo "$decl
  234. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  235. eval $compile
  236. if test -s conftest && (./conftest) 2>/dev/null; then :
  237. else
  238.   alloca_missing=1
  239. fi
  240. rm -f conftest*
  241.  
  242. if test -n "$alloca_missing"; then
  243.   SAVELIBS="$LIBS"
  244.   # Maybe alloca is in a different library.
  245.   if test -f /usr/ucblib/libucb.a; then
  246.     LIBS="$LIBS -L/usr/ucblib -lucb" trylib=-lucb # SVR4
  247.   elif test -f /lib/libPW.a; then
  248.     LIBS="$LIBS -lPW" trylib=-lPW # SVR2 and SVR3
  249.   fi
  250.   if test -n "$trylib"; then
  251.     alloca_missing=
  252.     echo checking for alloca in $trylib
  253. echo "$decl
  254. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  255. eval $compile
  256. if test -s conftest && (./conftest) 2>/dev/null; then :
  257. else
  258.   alloca_missing=1
  259. fi
  260. rm -f conftest*
  261.  
  262.   fi
  263.   if test -n "$alloca_missing"; then
  264.     LIBS="$SAVELIBS" ALLOCA=alloca.o
  265.   fi
  266. fi
  267.  
  268. echo checking for Minix
  269. test -d /usr/include/minix &&
  270.   DEFS="$DEFS -D_POSIX_SOURCE=1" DEFS="$DEFS -D_POSIX_1_SOURCE=2" DEFS="$DEFS -D_MINIX=1"
  271.  
  272. trap 'rm -f Makefile config.status; exit 1' 1 3 15
  273.  
  274. if test -n "$prefix"; then
  275.   prsub="s,^prefix[     ]*=.*$,prefix = $prefix,
  276. s,^exec_prefix[     ]*=.*$,exec_prefix = $exec_prefix,"
  277. fi
  278.  
  279. for file in Makefile; do
  280.   # Not all systems have dirname.
  281.   dir=`echo $file|sed 's,/[^/][^/]*$,,'`
  282.   test "$dir" != "$file" && test ! -d $dir && mkdir $dir
  283.   echo creating $file
  284.   echo "# Generated automatically from `basename $file`.in by configure." > $file
  285.   sed -e "
  286. $vpsub
  287. $srsub
  288. s,@VPATH@,$VPATH,
  289. $prsub
  290. s,@CC@,$CC,
  291. s,@INSTALL@,$INSTALL,
  292. s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,
  293. s,@INSTALL_DATA@,$INSTALL_DATA,
  294. s,@ALLOCA@,$ALLOCA,
  295. s,@DEFS@,$DEFS,
  296. s,@LIBS@,$LIBS,
  297. " $srcdir/${file}.in >> $file
  298. echo "
  299. # Prevent GNU make v3 from overflowing arg limit on SysV.
  300. .NOEXPORT:" >> $file
  301. done
  302.  
  303. echo creating config.status
  304. rm -f config.status
  305. echo "#!/bin/sh
  306. # Generated automatically by configure.
  307. # Run this file to recreate the current configuration.
  308. $0 $*" > config.status
  309. chmod +x config.status
  310.  
  311.